﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Collections;
using KaiXin001er.UTIL;

namespace KaiXin001er.Logic
{
    public class 请求参数
    {
        private List<KeyValuePair<string, string>> paramsList = new List<KeyValuePair<string,string>>();
        public void add(string key,string value)
        {
            KeyValuePair<string, string> kv = new KeyValuePair<string, string>(key, value);
            paramsList.Add(kv);
        }
        public override string ToString()
        {
            if (paramsList.Count == 0) return "";
            StringBuilder strbuilder = new StringBuilder();
            foreach (KeyValuePair<string, string> kv in paramsList)
            {
                strbuilder.Append(kv.Key +"="+ StringHelper.UrlEncode(kv.Value)+"&");
                
            }
            string retstr = strbuilder.ToString();
            return retstr.Substring(0, retstr.Length - 1);
        }
    }
}
